package com.huluobo.a2203parkdemo.repair

import androidx.lifecycle.MutableLiveData
import com.huluobo.base.mvvm.BaseViewModel
import com.huluobo.base.net.ApiService
import com.huluobo.base.net.ApiServiceLogin
import dagger.hilt.android.lifecycle.HiltViewModel
import okhttp3.RequestBody
import javax.inject.Inject

/**
 *  Created by LC on 2024/7/29.
 */
@HiltViewModel
class RepairViewModel @Inject constructor(
    val apiService: ApiService
) : BaseViewModel() {
    val getRepairListSuccess by lazy { MutableLiveData<String>() }

    fun getRepairList() {
        executeNetRequest(
            { apiService.getRepairList() },
            getRepairListSuccess::postValue
        )
    }

    val repairCompleteSuccess by lazy { MutableLiveData<String>() }
    fun repairComplete(body: RequestBody) {
        executeNetRequest(
            { apiService.repairComplete(body) },
            repairCompleteSuccess::postValue
        )
    }

    val addRepairSuccess by lazy { MutableLiveData<String>() }

    fun addRepair(body: RequestBody) {
        executeNetRequest(
            { apiService.addRepair(body) },
            addRepairSuccess::postValue
        )
    }
}